[Top] [Prev] [Next] [Bottom] [Contents]

Testing Sapphire's Access To the Tools

The five scripts above each refer to a tool that should be present on your system. The purpose of this section is to make sure that Sapphire/Web can access these various tools.

saweb.sh

If you have Sapphire/Web already running, then saweb.sh is working correctly. Please skip down to "saedithtml.sh."

If Sapphire/Web is not running, begin by setting the SAPPHIRE environment variable. This tells the shell where Sapphire/Web is located. The command env will list all environment variables and their values.

To set SAPPHIRE to sapphire_home:

C shell
	setenv SAPPHIRE sapphire_home
Bourne/Korn shell:
	SAPPHIRE=sapphire_home; export SAPPHIRE
	
If you have not already done so, please run:

	$SAPPHIRE/Install					
This script will also check for database configuration and set up libraries under SunOS or Solaris. If you have not already done so, run:

	$SAPPHIRE/bin/saweb.sh &
This should start Sapphire/Web. If it does this, then saweb.sh is working correctly.

saedithtml.sh

The first window that you see in Sapphire/Web is the Project Window (fig. 3-1). It is used to manage any projects that you create. From the Project Window (called noname.pj), click on the Document Manager button or select the menu item Tools->Document Manager.

Figure 3-1 Project Window-Document Manager icon

The Document Manager (fig. 3-2) is used to create and manage the HTML files used in your project. From the Document Manager, you will test your HTML editor to make sure it is accessible from Sapphire/Web.

Figure 3-2 Document Manager

Click on the second icon in the text field (Create New HTML) then type:

	test.html
Click Ok.

If your editor comes up with an HTML template, this script is correct. Please skip to the "sabrowser.sh" section.

If your editor does not come up, the most likely problem is that Sapphire/Web cannot locate it. From the command line (in an xterm), edit $SAPPHIRE/bin/saedithtml.sh by invoking your editor. For example:

	% vi $SAPPHIRE/bin/saedithtml.sh
We have included a vi reference table at the end of this chapter for your convenience.

At the beginning of saedithtml.sh, there is an environment variable called EDITOR. Please change that to reflect your preferred HTML editor. Example-if you want to use /usr/local/bin/emacs, change the line from:

EDITOR="xterm -e vi"
to:
EDITOR="xterm -e /usr/local/bin/emacs"

sabrowser.sh

If you have not already done so, please start Sapphire/Web following the steps in the saweb.sh section. To make sure your web browser is configured, please do the following:

1. From the Document Manager, highlight test.html. Then click the Preview HTML button (fig. 3-2).
2. Your web browser should appear with the test.html file displayed. If this happens, sabrowser.sh is working correctly. Skip down to the "samake.sh" section of this chapter.
If your browser does not appear, the most likely problem is that Sapphire/Web cannot locate it. From the command line (in an xterm), please edit $SAPPHIRE/bin/sabrowser.sh:
	% vi $SAPPHIRE/bin/sabrowser.sh
3. At the beginning of saedithtml.sh, there is an environment variable called BROWSER. Please change that to reflect the full path for your preferred web browser. Example: if Netscape is not in your path, but is in /pkg/ns-2.0, change the line from
	BROWSER=netscape
to
	BROWSER=/pkg/ns-2.0/netscape
You can find the full path of Netscape in your system with the command which netscape.

You may wish to define the browser on a per-user basis rather than system-wide. To do this, copy sabrowser.sh into a project/bin directory and make changes to it. Then set the PATH environment variable such that project/bin is before the $SAPPHIRE/bin directory in your path. This will cause Sapphire/Web to load browser-related information from your personal sabrowser.sh rather than the system-wide version.

On systems with limited resources, you may see the Netscape logo flashing when you enter and leave the browser. Change the -install option of netscape to -ncol 90 to avoid this by limiting the number of colors that Netscape uses.

samake.sh

Now that the web browser and editor are properly configured, the next step is to make sure the code generation tools are set up correctly. The best way to do this is to actually make a very simple project with Sapphire/Web.

1. Create a temporary directory, then change directory into it. For example:
	% mkdir /tmp/foo
	% cd /tmp/foo
2. If it is not currently started, please start Sapphire/Web by typing
	$SAPPHIRE/bin/saweb.sh &
Once Sapphire/Web has started, bring up the Document Manager by clicking the Document Manager icon or by selecting the menu item Tools->Document Manager.

3. Click the Create New HTML icon (fig. 3-2) or select the menu item File->Create.
4. Type begin.html as the name of the first HTML document.
5. Using your HTML editor, change begin.html to the following.
	<HTML>
	<HEAD><TITLE> First Document </TITLE></HEAD>
	<BODY>
	This is the first document. Click 
	<A HREF="GO">here</A> to go to the next.
	</BODY>
	</HTML>
Use your editor/browser to view the HTML document (fig. 3-3). The hyperlink here will not yet be functional.

Figure 3-3 Browser view of begin.html

6. As in step 4, create a second HTML document called end.html.
7. Using your HTML editor, change end.html to the following.
	<HTML>
	<HEAD><TITLE> Final Document </TITLE></HEAD>
	<BODY>
	This is the final document. Cool.
	</BODY>
	</HTML>
Use your editor/browser to view the HTML document (fig. 3-4).

Figure 3-4 Browser view of end.html

Now that you have completed both of the HTML documents, you will create a binding between them, activating the hyperlink. Before proceeding, make sure your Sapphire/Gateway is open.
8. Go back to the Sapphire Project Window to begin binding documents. From the Project Window, select the Object Bind Editor by clicking the Object Bind Editor (New Activator) icon or by selecting the menu item
Tools->Object Bind Editor.
9. An intermediate window pops up (the Activator Selector, fig. 3-5).

Figure 3-5 Activator Selector

10. Under the Document section select begin.html. Under the Anchors section, select HREF=GO. Click Ok.
11. The Open DSQL (or Open Procedure) window should pop up (fig. 3-6). Click on the arrow button to bring up the menu of bind types. Select NULL, then click Ok.

Figure 3-6 Open DSQL

.

Figure 3-7 Object Bind Editor

12. In the Object Bind Editor (fig. 3-7), click on the Results<=>Template down arrow and then select end.html. Click Ok. Since this is a NULL binding, no additional work is required. The Object Bind Editor will close and the Project Window will appear.
You are now ready to build the project.
13. Select the menu item File->Build Project. Sapphire/Web will prompt you for a project file.
14. Save your project as test.pj. If you see the following messages, samake.sh is configured correctly.
	Compiling test.c [ANSI C]
	Compiling begin.c [ANSI C]
	Linking test.cgi
	Finished Linking
15. If all of these messages do not appear, edit $SAPPHIRE/bin/samake.sh and change the line
	MAKE=make
to
	MAKE=make_location
where make_location is the full path to the location of make on your system. You can find the full path to make with the command which make. Also, make sure that the setting "CC=" in the file $SAPPHIRE/config/Makefile.tem is pointing to a valid compiler/linker.

satest.sh

This script installs your project into a test HTML directory after the project application (application server, CGI, etc.) has been generated. The script also uses two of the scripts mentioned before (sabrowser.sh and samake.sh); make sure that these two scripts are configured correctly. In order to use satest.sh, there are four configuration options that need to be set: CGI test Path, CGI test URL, HTML test Path, and HTML test URL.

1. Create a temporary directory and change directory into it. For example:
	% mkdir /tmp/foo
	% cd /tmp/foo
2. If Sapphire/Web is not already started, please start it by typing
	$SAPPHIRE/bin/saweb.sh &
3. From the Project Window select the menu item Edit->Options. At the Category popup menu, select the Test category. You will now change the four options listed above.
4. CGI Path: This is the file path that CGIs are installed to. If your HTTP server is configured to execute CGIs from any directory, you should probably use something of the form
	/home_directory/public_html/cgi-bin
where /home_directory is your home directory. If you plan to install your CGIs to a different machine, this option should have the form
	machine:/home_directory/public_html/
Your web administrator should be able to tell you where to install CGI executables.
5. CGI URL: This is the URL used to reference a CGI installed to the above CGI path. For example, if a CGI were installed to
	/some_location/cgi-bin
and the HTTP server document root was /some_location/ then the CGI URL would be set to:
	http://machine/cgi-bin
If you're not sure what the HTTP server document root is for your server, ask your web administrator.
6. HTML Path: This is the file path where HTML documents are installed. Since this is the project test phase rather than the final release, you probably want to use a personal home directory rather than the main HTTP server document root. For example,
	/home_directory/public_html/
where /home_directory is your home directory. If you plan to install your HTML documents to a different machine, this option should have the form:
	machine:/home_directory/public_html/cgi-bin
7. HTML URL: This is the URL used to reference an HTML document installed to the above HTML path. For example, if a document were installed to:
	/some_location/docs/
and the HTTP server document root was /some_location/docs then the HTML URL would be set to:
	http://machine/
8. Click Ok once these options are set. In the Project window, click the Test button or select the menu item File->Test. Your web browser should appear with the first page.
9. Click on the here link. The browser should then switch to the end.html page.
10. If everything works, make sure you save your options by selecting the menu item Edit->Save Options.
You have successfully validated your CGI and HTML set-up. Please complete Chapters 4 and 5 to set up the Sapphire/Gateway and the Sapphire/Web tutorials.



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.